#ifndef SKILL_HH
#define SKILL_HH
/*
The Skill system is managed by the CharacterWithSkills class, enabling characters to add, equip, and execute skills with cooldown tracking. 
Skills (e.g., HealWounds, Fireball, DarkPact) inherit from the Skill base class, defining unique effects like damage, healing, temporary stat boosts 
(e.g., BuffArmor increases defense), crowd control (stun via ShieldBash), or self-sacrificial attacks. The system allows equipping skills into 4 slots, 
managing cooldowns, and applying effects during combat (e.g., PoisonDart inflicts damage and poison, RapidShot deals dual hits). 
Skills dynamically interact with targets (players/enemies), modify battle states (stress relief, marked vulnerability), 
and support strategic gameplay through skill selection and cooldown management.
*/
/*
* 技能系统由CharacterWithSkills类管理，实现：
* - 技能操作：添加/装备/执行
* - 冷却计时机制*/

#include "Character.hh"
#include <iostream>
#include <vector>

namespace DungeonRPG{

class Character;

class Skill {
public:
    std::string name;
    std::string description;
    int cooldown;
    int remainingCooldown;

    Skill(const std::string& n, const std::string& d, int cd)
        : name(n), description(d), cooldown(cd), remainingCooldown(0) {}

    virtual void activate(Character* user, Character* target) = 0;

    void resetCooldown() { remainingCooldown = cooldown; }
    void reduceCooldown() { if (remainingCooldown > 0) --remainingCooldown; }
    bool isReady() const { return remainingCooldown == 0; }

    virtual ~Skill() {}
};

// ===== CharacterWithSkills =====
class CharacterWithSkills {
protected:
    std::vector<Skill*> allSkills;
    std::vector<Skill*> equippedSkills;

public:
    void addSkill(Skill* skill);
    void equipSkill(int index, int slot);
    void showEquippedSkills() const;
    void reduceSkillCooldowns();
    void resetBattleBuffs(); 
    Skill* getSkill(int slot);
    virtual ~CharacterWithSkills();
};

// ===== 15个具体技能 =====
class BuffArmor : public Skill { public: BuffArmor(); void activate(Character*, Character*) override; };
class HealWounds : public Skill { public: HealWounds(); void activate(Character*, Character*) override; };
class HeavyStrike : public Skill { public: HeavyStrike(); void activate(Character*, Character*) override; };
class Fireball : public Skill { public: Fireball(); void activate(Character*, Character*) override; };
class IceSpike : public Skill { public: IceSpike(); void activate(Character*, Character*) override; };
class LightningStrike : public Skill { public: LightningStrike(); void activate(Character*, Character*) override; };
class PoisonDart : public Skill { public: PoisonDart(); void activate(Character*, Character*) override; };
class ShieldBash : public Skill { public: ShieldBash(); void activate(Character*, Character*) override; };
class RallyCry : public Skill { public: RallyCry(); void activate(Character*, Character*) override; };
class BleedStrike : public Skill { public: BleedStrike(); void activate(Character*, Character*) override; };
class DarkPact : public Skill { public: DarkPact(); void activate(Character*, Character*) override; };
class Purify : public Skill { public: Purify(); void activate(Character*, Character*) override; };
class RapidShot : public Skill { public: RapidShot(); void activate(Character*, Character*) override; };
class MarkTarget : public Skill { public: MarkTarget(); void activate(Character*, Character*) override; };
class Fortify : public Skill { public: Fortify(); void activate(Character*, Character*) override; };

}

#endif // SKILL_HH
